﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace COSIX.Commands.Commands
{
    class HelpCommand : CommandBase
    {
        public string Name = "Help";
        public string CommandName = "help";
        public string Help = "Display a list of all available commands.";
        public string LongHelp = "Syntax:\nhelp: Display a list of all available commands.\n help <command>: Display the help for the specified command.";

        public override void Run(string args)
        {
            Console.BackgroundColor = ConsoleColor.Cyan;
            Console.WriteLine("COSIX | Help");
            if (string.IsNullOrWhiteSpace(args) || string.IsNullOrEmpty(args))
            {
                for (int i = 0; i < Global.CmdMgr.Commands.Count; i++)
                {
                    Console.Write(Global.CmdMgr.Commands[i].Name);
                    Console.Write(": ");
                    Console.WriteLine(Global.CmdMgr.Commands[i].Help);
                }
            }
            else
            {
                Console.WriteLine("COSIX | Help for " + args);
            }
            Console.BackgroundColor = ConsoleColor.Black;
        }
    }
}
